package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.ProductBean;
import com.project.mapper.IProductMapper;
import com.project.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author lyl
 * description:
 */
@Service
@Transactional
public class ProductServiceImpl implements IProductService {
    @Autowired
    private IProductMapper iProductMapper;

    @Override
    public PageInfo<ProductBean> findByItem(int pageNo, String productName) {
        PageHelper.startPage(pageNo, 3);
        PageInfo<ProductBean> info = PageInfo.of(iProductMapper.findByItem(productName));
        return info;
    }

    @Override
    public ProductBean findById(int productId) {
        return iProductMapper.findById(productId);
    }
}
